
import AbsControler from '../abscontroler.js'
import LMosDownTool from './modify/act2lmosdown.js'
import LMosUpTool from './modify/act2lmosup.js'
import RMosUpTool from './modify/act2rmosup.js'
import MosMoveTool from './modify/act2mosmove.js'
import DBLClickTool from './modify/act2dblclick.js'
import LMosDragTool from './modify/actLMosDrag.js'
import LXCOM from '../../common/common.js'
import {LGXEnums}  from '../../common/sysenum.js'

class SingleModifyControler extends AbsControler.AbsControler  {
    constructor(datamanger) {
        super(datamanger);
        this.m_tLastLMosDownPt = new LXCOM.LGXPoint();
    }

    act2Mouse(mosEvnt,worldPos) {
        // console.log("SingleModifyControler");
        // console.log(mosEvnt);
        if (mosEvnt.type == LGXEnums.LGXMouseMode.LMouseDown) {
            this.m_tLastLMosDownPt.clone(worldPos);
            LMosDownTool.LeftMoseDownTool.action(this.dataManger,mosEvnt,worldPos);
        }
        else if (mosEvnt.type == LGXEnums.LGXMouseMode.LMouseUp) {
            LMosUpTool.LeftMoseUpTool.action(this.dataManger,mosEvnt,worldPos);
        }
        else if (mosEvnt.type == LGXEnums.LGXMouseMode.RMouseUp) {
            RMosUpTool.RightMoseUpTool.action(this.dataManger,mosEvnt,worldPos);
        }
        else if (mosEvnt.type == LGXEnums.LGXMouseMode.LMouseDbClick){
            DBLClickTool.DBLClickTool.action(this.dataManger,mosEvnt,worldPos);
        }
        else if (mosEvnt.type == LGXEnums.LGXMouseMode.mouseMove){
            MosMoveTool.MosMoveTool.action(this.dataManger,mosEvnt,worldPos);
        }
        else if (mosEvnt.type == LGXEnums.LGXMouseMode.mouseDrag){
            // console.log("lmousedrag---begin");
            LMosDragTool.LMosDragTool.action(this.dataManger,mosEvnt,worldPos,this.m_tLastLMosDownPt);
            // console.log("lmousedrag---end");
        }
        this.m_tLastLMosDownPt.clone(worldPos);
    }
}

export default { SingleModifyControler }

